package com.example.study.common.base;

/**
 * @author kuotian
 */
public class BaseException extends RuntimeException {
    private static final long serialVersionUID = -1222124985380697312L;
    private int code;

    public BaseException() {}

    public BaseException(Throwable cause) {
        super(cause);
    }

    public BaseException(int code) {
        this.code = code;
    }

    public BaseException(RestResponseCode restResponseCode) {
        super(restResponseCode.getMessage());
        this.code = restResponseCode.getCode();
    }

    public BaseException(String message) {
        super(message);
        this.code = CommonResponseCode.FAIL.getCode();
    }

    public BaseException(int code, String message) {
        super(message);
        this.code = code;
    }

    public int getCode() {
        return code;
    }
}
